# Contributor: Saijin-Naib <Saijin-Naib_package-maintenance@outlook.com>
# Maintainer: Saijin-Naib <Saijin-Naib_package-maintenance@outlook.com>
pkgname=libopenraw
pkgver=0.3.6
pkgrel=1
pkgdesc="Desktop agnostic effort to support digital camera RAW files"
url="https://libopenraw.freedesktop.org/"
arch="all"
license="LGPL-3.0-or-later"
makedepends="
	boost-dev
	cargo
	curl-dev
	gdk-pixbuf-dev
	libjpeg-turbo-dev
	libxml2-dev
	"
subpackages="$pkgname-dev $pkgname-pixbuf-loader"
source="https://libopenraw.freedesktop.org/download/libopenraw-$pkgver.tar.bz2
	getrandom-0.2.10.patch
	"
options="net" # cargo fetch

prepare() {
	default_prepare
	update_config_sub

	cd lib/mp4
	cargo vendor --config net.offline=false --locked
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-static
	make
}

check() {
	make check
}

package() {
	make install DESTDIR="$pkgdir"
}

loader() {
	pkgdesc="$pkgdesc (pixbuf loader)"
	install_if="$pkgname=$pkgver-r$pkgrel gdk-pixbuf-loaders"

	amove \
		usr/lib/gdk-pixbuf-*/*/loaders
}

sha512sums="
3c857084009e219446fd43258c0fed1e1de6fcb480015c158d6b17e1b0fe99647393e97cb08772c66aad56bea88a6e092e84a37283c03535acc50aba07758740  libopenraw-0.3.6.tar.bz2
b2ac2e41d5582873dbcd354e9649af64f10e57e1bec0a2c84ce7b1a7e43e1763e86bf1dacf86f0537efcbdfd88ee2c43f0213b0e2b36a87380a71c8336787231  getrandom-0.2.10.patch
"
